
import { Base } from '../utils/base.js';

class User extends Base {
    constructor() {
        super();
    }
    /**
     * 获取用户信息
     */
    getUserInfo(callBack) {
        var params = {
            url: 'user',
            sCallBack: function (res) {
                callBack && callBack(res);
            }
        }
        this.request(params);
    }

    /**
     * 更新用户信息
     */
    updateUser(data, callBack) {
        var params = {
            url: 'user',
            type: 'PUT',
            data: data,
            sCallBack: function (res) {
                callBack && callBack(res);
            },
        }
        this.request(params);
    }

     /**
     * 绑定上下级关系
     */
    createInvite(data, callBack) {
        var params = {
            url: 'invite',
            type: 'POST',
            data: data,
            sCallBack: function (res) {
                callBack && callBack(res);
            },
        }
        this.request(params);
    }

    //获取手机号
    phonePost(data, callBack) {
        var params = {
            url: 'user/phone',
            type: 'POST',
            data: data,
            sCallBack: function (res) {
                callBack && callBack(true, res);
            },
            eCallBack: function (res) {
                callBack && callBack(false, res);
            },
        }
        this.request(params);
    }

    // 提现
    createMoney(data, callBack) {
        var params = {
            url: 'user/money',
            type: 'POST',
            data: data,
            sCallBack: function (res) {
                callBack && callBack(true, res);
            },
            eCallBack: function (res) {
                callBack && callBack(false, res);
            },
        }
        this.request(params);
    }
}

export { User };
